//
// Created by Criinal Nicole on 2020/6/17.
//

#include "Block.h"

BLOCK::Block BLOCK::blocks[BLOCK::MAX_BLOCK_NUM];

void BLOCK::init() {
    for (int i = BLOCK_SIZE_INT; i < MAX_BLOCK_NUM; i += BLOCK_SIZE_INT + 1) {
        int j;
        for (j = 0; j + i + 1 < MAX_BLOCK_NUM && j < BLOCK_SIZE_INT; ++j) {
            blocks[i]._blockStack[j] = i + j + 1;
        }
        blocks[i]._blockStackSizeInt = j;
        blocks[i]._nextBlockStack = i + BLOCK_SIZE_INT+1;
        if (i + BLOCK_SIZE_INT >= MAX_BLOCK_NUM) {
            blocks[i]._nextBlockStack = -1;
        }
    }
}
